using System;
using System.Collections.Generic;
using DMS.BEs;

namespace ObjectFactories {
	public class EmployeeFactory {

		private readonly Employee[] items = new Employee[9];
		private static EmployeeFactory instance;

		private EmployeeFactory() {
			items[1] = new Employee {FirstName = "Andrew", LastName = "Adams", Address = "11120 Jasper Ave NW", City = "Edmonton", State = "AB", Country = "Canada", Email = "andrew@chinookcorp.com", Fax = "+1 (780) 428-3457", Phone = "+1 (780) 428-9482", PostalCode = "T5K 2N1", Title = "General Manager", BirthDate = new DateTime(1962, 2, 18), HireDate = new DateTime(2002, 8, 14)};
			items[2] = new Employee {FirstName = "Nancy", LastName = "Edwards", Address = "825 8 Ave SW", City = "Calgary", State = "AB", Country = "Canada", Email = "nancy@chinookcorp.com", Fax = "+1 (403) 262-3322", Phone = "+1 (403) 262-3443", PostalCode = "T2P 2T3", Title = "Sales Manager", BirthDate = new DateTime(1958, 12, 8), HireDate = new DateTime(2002, 5, 1), ReportsTo = items[1]};
			items[3] = new Employee {FirstName = "Jane", LastName = "Peacock", Address = "1111 6 Ave SW", City = "Calgary", State = "AB", Country = "Canada", Email = "jane@chinookcorp.com", Fax = "+1 (403) 262-6712", Phone = "+1 (403) 262-3443", PostalCode = "T2P 5M5", Title = "Sales Support Agent", BirthDate = new DateTime(1973, 8, 29), HireDate = new DateTime(2002, 4, 1), ReportsTo = items[2]};
			items[4] = new Employee {FirstName = "Margaret", LastName = "Park", Address = "683 10 Street SW", City = "Calgary", State = "AB", Country = "Canada", Email = "margaret@chinookcorp.com", Fax = "+1 (403) 263-4289", Phone = "+1 (403) 263-4423", PostalCode = "T2P 5G3", Title = "Sales Support Agent", BirthDate = new DateTime(1947, 9, 19), HireDate = new DateTime(2003, 5, 3), ReportsTo = items[2]};
			items[5] = new Employee {FirstName = "Steve", LastName = "Johnson", Address = "7727B 41 Ave", City = "Calgary", State = "AB", Country = "Canada", Email = "steve@chinookcorp.com", Fax = "1 (780) 836-9543", Phone = "1 (780) 836-9987", PostalCode = "T3B 1Y7", Title = "Sales Support Agent", BirthDate = new DateTime(1965, 3, 3), HireDate = new DateTime(2003, 10, 17), ReportsTo = items[2]};
			items[6] = new Employee {FirstName = "Michael", LastName = "Mitchell", Address = "5827 Bowness Road NW", City = "Calgary", State = "AB", Country = "Canada", Email = "michael@chinookcorp.com", Fax = "+1 (403) 246-9899", Phone = "+1 (403) 246-9887", PostalCode = "T3B 0C5", Title = "IT Manager", BirthDate = new DateTime(1973, 7, 1), HireDate = new DateTime(2003, 10, 17), ReportsTo = items[1]};
			items[7] = new Employee {FirstName = "Robert", LastName = "King", Address = "590 Columbia Boulevard West", City = "Lethbridge", State = "AB", Country = "Canada", Email = "robert@chinookcorp.com", Fax = "+1 (403) 456-8485", Phone = "+1 (403) 456-9986", PostalCode = "T1K 5N8", Title = "IT Staff", BirthDate = new DateTime(1970, 5, 29), HireDate = new DateTime(2004, 1, 2), ReportsTo = items[6]};
			items[8] = new Employee {FirstName = "Laura", LastName = "Callahan", Address = "923 7 ST NW", City = "Lethbridge", State = "AB", Country = "Canada", Email = "laura@chinookcorp.com", Fax = "+1 (403) 467-8772", Phone = "+1 (403) 467-3351", PostalCode = "T1H 1Y8", Title = "IT Staff", BirthDate = new DateTime(1968, 1, 9), HireDate = new DateTime(2004, 3, 4), ReportsTo = items[6]};
		}

		static public void Reset() {
			instance=null;
		}

		static public EmployeeFactory GetInstance() {
			if (instance==null) instance = new EmployeeFactory();
		return instance;
		}

		static public IList<Employee> GetAll() {
			return GetInstance().items;
		}

		static public Employee GetByOriginalId(int? id)
		{
			return id.HasValue ? GetInstance().items[id.Value] : null;
		}
	}
}
